package toolkits;

import java.io.FileInputStream;
import java.util.Map;
import java.util.Properties;
import java.util.SortedMap;
import java.util.TreeMap;


public class CompareProperty {

    /**
     * @param args
     */
    public static void main(String[] args)throws Exception {
        /*
        KeyGenerator kg = KeyGenerator.getInstance("AES");
        //kg.init(128);//16 Default
        //kg.init(192);//24
        kg.init(256);//32
        SecretKey key = kg.generateKey();
        
        System.out.println(key.getClass().getName());
        
        System.out.println(key.getAlgorithm());
        System.out.println(key.getFormat());
        System.out.println(key.getEncoded().length);
        */
        
        String messages_properties_f="D:\\My Documents\\Downloads\\pci_local.txt";
        //String messages_properties_f="E:\\workspace3.4\\Commerce7.6.10\\src\\main\\webapp\\WEB-INF\\i18n\\messages.properties";
        FileInputStream fstream = new FileInputStream(messages_properties_f);
        Properties messages_properties = new Properties();
        messages_properties.load(fstream);
        
        
        String messages_en_properties_f="D:\\My Documents\\Downloads\\pci_geiger.txt";
        //String messages_en_properties_f="E:\\workspace3.4\\Commerce7.6.10\\src\\main\\webapp\\WEB-INF\\i18n\\messages_en.properties";
        FileInputStream fstream_en = new FileInputStream(messages_en_properties_f);
        Properties messages_en_properties = new Properties();
        messages_en_properties.load(fstream_en);
        
        SortedMap result=new TreeMap();
        for(Map.Entry me : messages_en_properties.entrySet()){
            if(!messages_properties.containsKey(me.getKey())){
                result.put(me.getKey(), me.getValue());
            }else if(!me.getValue().toString().trim().equalsIgnoreCase(messages_properties.get(me.getKey()).toString().trim())){
                System.out.println(me.getKey()+"="+me.getValue()+ "<--->"+messages_properties.get(me.getKey()));
            }
        }
        
        for(Object key : result.keySet()){
            System.out.println("Do not contain result:");
            System.out.println(key+"="+result.get(key));
        }
        
    }

}
